<script setup>

/**
 * 定义props 属性
 */
const props = defineProps({
  row: {
    type: Number,
    default: 1,
  },
  hoverTip: {
    type: Boolean,
    default: false,
  },
  content: {
    type: String,
    default: "",
  },
})

</script>

<template>
  <div
    :class="{ line: props.row === 1, lines: props.row > 1 }"
    :title="props.hoverTip ? props.content : null"
    :style="{ '--row': props.row }"
  >
    {{ props.content }}
  </div>
</template>

<style lang="scss" scoped>
.line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lines {
  display: -webkit-box;
  word-break: break-all;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: var(--row);
  -webkit-box-orient: vertical;
}
</style>
